package qz_rpt

class OrderProgressController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }
    def orderProgress(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        println(params.partDesc)
        params.SYS_QUERY_NAME = 'orderProgress'
        def orderProgress = dynamicQueryService.queryForList(params)
        def tableHeadList =  []
        if(orderProgress.size()>0){
            tableHeadList =  orderProgress[0].keySet()
        }
        params.SYS_QUERY_NAME = 'orderProgressCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        print(totalCount)
        params.SYS_QUERY_NAME = 'orderProgressLineList'
        def orderProgressLineList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'orderProgressPartName'
        def orderProgressPartName = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'orderProgressPartDesc'
        def orderProgressPartDesc = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'orderProgressType'
        def orderProgressType = dynamicQueryService.queryForList(params)
        [totalCount:totalCount,tableHeadList:tableHeadList,
         pageSizeList:pageSizeList,pageSize:pageSize,
         startno:params.startno?:'',endno:params.endno?:'',
         orderProgress:orderProgress,lineId:params.lineId?:'',partName:params.partName?:'',partDesc:params.partDesc?:'',category:params.category?:'',
        startTime:params.startTime?:'',endTime:params.endTime?:'',orderProgressLineList:orderProgressLineList,orderProgressPartName:orderProgressPartName,
         orderProgressPartDesc:orderProgressPartDesc,orderProgressType:orderProgressType]
    }
}
